#include "../pch.h"
#include "CVoiceSlider.h"
#include "../../common-define/OwerDefine.h"
#include <iostream>
using std::cout;
using std::endl;

CVoiceSlider::CVoiceSlider():CBitSlider()
{
}

CVoiceSlider::~CVoiceSlider()
{
}

BEGIN_MESSAGE_MAP(CVoiceSlider, CBitSlider)
	ON_WM_HSCROLL()
	ON_WM_LBUTTONDOWN()
	ON_WM_PAINT()
END_MESSAGE_MAP()




void CVoiceSlider::OnLButtonDown(UINT nFlags, CPoint point)
{
	CSliderCtrl::OnLButtonDown(nFlags, point);

	CRect   rectClient, rectChannel;
	GetClientRect(rectClient);
	GetChannelRect(rectChannel);
	int nMax = 0;
	int nMin = 0;
	GetRange(nMin, nMax);
	int nPos =
		(nMax - nMin) * (point.x - rectClient.left - rectChannel.left) / (rectChannel.right - rectChannel.left);
	SetPos(nPos);
}


